﻿using CRMG.Container.Resources.ExceptionResources;
using CRMG.Container.Source.Helper;
using CRMG.Container.Source.Variables;
using CRMG.Container.Views.BaseList;
using CRMG.Container.Views.InterViews;
using CRMG.Container.Views.Payments;
using CRMG.Container.Views.Studnt;
using CRMG.Container.Views.Training;
using Guru.ErrorHandling;
using System;
using System.Globalization;
using System.Resources;
using System.Threading;
using Telerik.WinControls.UI;

namespace CRMG.Container
{
    public partial class CRMGContainer : FrmBase
    {
        ResourceManager formRes;
        ResourceManager messageRes;

        public CRMGContainer()
            : base()
        {
            try
            {
                Thread.CurrentThread.CurrentUICulture = new CultureInfo(AppVariables.ApplicationCulture);
                this.InitializeComponent();

                formRes = new ResourceManager("CRMG.Container.Resources.ControlResources.WinFormStrings", typeof(CRMGContainer).Assembly);
                messageRes = new ResourceManager("CRMG.Container.Resources.MessageResources.AppMessages", typeof(CRMGContainer).Assembly);

                rbnBrCustomer.Text = formRes.GetString("CRMGContainer.rbnBrCustomer");
                this.Text = rbnBrCustomer.Text;

                rbnTbMain.Text = formRes.GetString("CRMGContainer.rbnTbMain");

                rbnBarGrpContacts.Text = formRes.GetString("CRMGContainer.rbnBarGrpContacts");
                rbnBarGrpInterViews.Text = formRes.GetString("CRMGContainer.rbnBarGrpInterViews");
                rbnBrGrpPayments.Text = formRes.GetString("CRMGContainer.rbnBrGrpPayments");
                rbnBarGrpStudent.Text = formRes.GetString("CRMGContainer.rbnBarGrpStudent");
                rbnBrGrpTrain.Text = formRes.GetString("CRMGContainer.rbnBrGrpTrain");

                btnAddCustomer.Text = formRes.GetString("CRMGContainer.btnAddCustomer");
                btnEditCustomer.Text = formRes.GetString("CRMGContainer.btnEditCustomer");

                btnAddInterView.Text = formRes.GetString("CRMGContainer.btnAddInterView");
                btnInterViewList.Text = formRes.GetString("CRMGContainer.btnInterViewList");

                btnAddPayment.Text = formRes.GetString("CRMGContainer.btnAddPayment");
                btnPaymentList.Text = formRes.GetString("CRMGContainer.btnPaymentList");

                btnStudent.Text = formRes.GetString("CRMGContainer.btnStudent");
                btnStudentList.Text = formRes.GetString("CRMGContainer.btnStudentList");

                btnTrain.Text = formRes.GetString("CRMGContainer.btnTrain");
                btnAvailableTrain.Text = formRes.GetString("CRMGContainer.btnAvailableTrain");

            }
            catch (Exception exc)
            {
                LogEntry logger = new LogEntry(AppVariables.CurrentUser.OBJID)
                {
                    ErrorCode = 2005,
                    Message = exc.Message,
                    StackTrace = exc.StackTrace,
                    Title = Rc.GetString(2005)
                };
                logger.Write();
                ControlUtil.ShowErrorMessage(
                    messageRes.GetString("CRMGContainer.Ctor.Error"),
                    messageRes.GetString("Error"));
            }
            finally
            {
            }
        }

        private void btnAddInterView_Click(object sender, EventArgs e)
        {
            FrmInterView frmIntrVw = new FrmInterView();
            frmIntrVw.ShowDialog();
        }

        private void InterViewList(object sender, EventArgs e)
        {
            FrmInterViewList frmIntVwList = new FrmInterViewList();
            frmIntVwList.Show();
        }

        private void btnAddPayment_Click(object sender, EventArgs e)
        {
            FrmPayment pym = new FrmPayment();
            pym.Show();
        }

        private void btnPaymentList_Click(object sender, EventArgs e)
        {
            FrmPaymentList pymList = new FrmPaymentList();
            pymList.Show();
        }

        private void btnStudent_Click(object sender, EventArgs e)
        {
            FrmStudent frmStdnt = new FrmStudent();
            frmStdnt.Show();
        }

        private void btnStudentList_Click(object sender, EventArgs e)
        {
            FrmStudentList frmstdntList = new FrmStudentList();
            frmstdntList.Show();
        }

        private void btnTrain_Click(object sender, EventArgs e)
        {
            FrmTrain frmtrain = new FrmTrain();
            frmtrain.Show();
        }

        private void btnAvailableTrain_Click(object sender, EventArgs e)
        {
            FrmAvailableTrain frmAvTrain = new FrmAvailableTrain();
            frmAvTrain.Show();
        }

    }
}
